home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume6 / xfig2 / patch5d < prev    next >
Encoding:
Internet Message Format  |  1993-04-28  |  42.7 KB

  1. From: envbvs@epb2.lbl.gov (Brian V. Smith)
  2. Newsgroups: comp.sources.x
  3. Subject: v06i053: xfig 2.0 (part 4/7), Patch5
  4. Message-ID: <133694@sun.Eng.Sun.COM>
  5. Date: 30 Mar 90 04:33:37 GMT
  6. Approved: argv@sun.com
  7.  
  8. Submitted-by: envbvs@epb2.lbl.gov (Brian V. Smith)
  9. Posting-number: Volume 6, Issue 53
  10. Archive-name: xfig2/patch5d
  11. Patch-To: xfig2: Volume 6, Issue 9-24,34-36
  12.  
  13. #! /bin/sh
  14. # This is a shell archive.  Remove anything before this line, then unpack
  15. # it by saving it into a file and typing "sh file".  To overwrite existing
  16. # files, type "sh file -c".  You can also feed this as standard input via
  17. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  18. # will see the following message at the end:
  19. #        "End of archive 4 (of 7)."
  20. # Contents:  line.c.diff main.c.diff ruler.c.diff
  21. # Wrapped by envbvs@epb2.lbl.gov on Wed Mar 28 09:04:56 1990
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'line.c.diff' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'line.c.diff'\"
  25. else
  26. echo shar: Extracting \"'line.c.diff'\" \(13070 characters\)
  27. sed "s/^X//" >'line.c.diff' <<'END_OF_FILE'
  28. X*** line.c.p5    Tue Jan 16 17:21:07 1990
  29. X--- line.c    Tue Mar 27 13:59:00 1990
  30. X***************
  31. X*** 30,36
  32. X  extern int        latexline_mode, latexarrow_mode;
  33. X  extern int        magnet_mode, latexarrow_mode;
  34. X  extern int        autoforwardarrow_mode, autobackwardarrow_mode;
  35. X! extern int        cur_line_style, line_thickness;
  36. X  extern float        cur_styleval;
  37. X  extern int        cur_color;
  38. X  extern F_compound    objects;
  39. X
  40. X--- 30,36 -----
  41. X  extern int        latexline_mode, latexarrow_mode;
  42. X  extern int        magnet_mode, latexarrow_mode;
  43. X  extern int        autoforwardarrow_mode, autobackwardarrow_mode;
  44. X! extern int        line_style, line_thickness;
  45. X  extern float        cur_styleval;
  46. X  extern int        cur_color;
  47. X  extern F_compound    objects;
  48. X***************
  49. X*** 104,110
  50. X  
  51. X  draw_elasticline()
  52. X  {
  53. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  54. X      }
  55. X  
  56. X  freehand_elasticline(x, y)
  57. X
  58. X--- 104,111 -----
  59. X  
  60. X  draw_elasticline()
  61. X  {
  62. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, 
  63. X!         INV_PAINT, 1, SOLID_LINE, 0.0);
  64. X      }
  65. X  
  66. X  freehand_elasticline(x, y)
  67. X***************
  68. X*** 122,128
  69. X      CURSOR c;
  70. X  
  71. X      latex_endpoint(fix_x, fix_y, cur_x, cur_y, &x, &y, latexarrow_mode, (magnet_mode)? 5: 1);
  72. X!     pw_vector(canvas_pixwin, fix_x, fix_y, x, y, INV_PAINT,1);
  73. X      c = (x == cur_x  &&  y == cur_y)? &null_cursor: &crosshair_cursor;
  74. X      if (c != cur_cursor) {
  75. X          set_temp_cursor(c);
  76. X
  77. X--- 123,129 -----
  78. X      CURSOR c;
  79. X  
  80. X      latex_endpoint(fix_x, fix_y, cur_x, cur_y, &x, &y, latexarrow_mode, (magnet_mode)? 5: 1);
  81. X!     pw_vector(canvas_pixwin, fix_x, fix_y, x, y, INV_PAINT,1,SOLID_LINE, 0.0);
  82. X      c = (x == cur_x  &&  y == cur_y)? &null_cursor: &crosshair_cursor;
  83. X      if (c != cur_cursor) {
  84. X          set_temp_cursor(c);
  85. X***************
  86. X*** 143,149
  87. X  int    x, y;
  88. X  {
  89. X      if (x == cur_x && y == cur_y) return;
  90. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  91. X      cur_x = x;
  92. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  93. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  94. X
  95. X--- 144,150 -----
  96. X  int    x, y;
  97. X  {
  98. X      if (x == cur_x && y == cur_y) return;
  99. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  100. X      cur_x = x;
  101. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  102. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  103. X***************
  104. X*** 145,151
  105. X      if (x == cur_x && y == cur_y) return;
  106. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  107. X      cur_x = x;
  108. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  109. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  110. X      }
  111. X  
  112. X
  113. X--- 146,152 -----
  114. X      if (x == cur_x && y == cur_y) return;
  115. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  116. X      cur_x = x;
  117. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  118. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  119. X      }
  120. X  
  121. X***************
  122. X*** 153,159
  123. X  int    x, y;
  124. X  {
  125. X      if (x == cur_x && y == cur_y) return;
  126. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  127. X      cur_y = y;
  128. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  129. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  130. X
  131. X--- 154,160 -----
  132. X  int    x, y;
  133. X  {
  134. X      if (x == cur_x && y == cur_y) return;
  135. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  136. X      cur_y = y;
  137. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  138. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  139. X***************
  140. X*** 155,161
  141. X      if (x == cur_x && y == cur_y) return;
  142. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  143. X      cur_y = y;
  144. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  145. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  146. X      }
  147. X  
  148. X
  149. X--- 156,162 -----
  150. X      if (x == cur_x && y == cur_y) return;
  151. X      pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  152. X      cur_y = y;
  153. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  154. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  155. X      }
  156. X  
  157. X***************
  158. X*** 163,169
  159. X  int    x, y;
  160. X  {
  161. X      if (x == cur_x && y == cur_y) return;
  162. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  163. X      if (abs(x - cur_x) < abs(y - cur_y)) {
  164. X          cur_x += cur_y - y;
  165. X          cur_y = y;
  166. X
  167. X--- 164,170 -----
  168. X  int    x, y;
  169. X  {
  170. X      if (x == cur_x && y == cur_y) return;
  171. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  172. X      if (abs(x - cur_x) < abs(y - cur_y)) {
  173. X          cur_x += cur_y - y;
  174. X          cur_y = y;
  175. X***************
  176. X*** 172,178
  177. X          cur_y -= x - cur_x;
  178. X          cur_x = x;
  179. X          }
  180. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  181. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  182. X      }
  183. X  
  184. X
  185. X--- 173,179 -----
  186. X          cur_y -= x - cur_x;
  187. X          cur_x = x;
  188. X          }
  189. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  190. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  191. X      }
  192. X  
  193. X***************
  194. X*** 180,186
  195. X  int    x, y;
  196. X  {
  197. X      if (x == cur_x && y == cur_y) return;
  198. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  199. X      if (abs(x - cur_x) < abs(y - cur_y)) {
  200. X          cur_x += y - cur_y;
  201. X          cur_y = y;
  202. X
  203. X--- 181,187 -----
  204. X  int    x, y;
  205. X  {
  206. X      if (x == cur_x && y == cur_y) return;
  207. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  208. X      if (abs(x - cur_x) < abs(y - cur_y)) {
  209. X          cur_x += y - cur_y;
  210. X          cur_y = y;
  211. X***************
  212. X*** 189,195
  213. X          cur_y += x - cur_x;
  214. X          cur_x = x;
  215. X          }
  216. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
  217. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  218. X      }
  219. X  
  220. X
  221. X--- 190,196 -----
  222. X          cur_y += x - cur_x;
  223. X          cur_x = x;
  224. X          }
  225. X!     pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
  226. X      win_setmouseposition(canvas_swfd, cur_x, cur_y);
  227. X      }
  228. X  
  229. X***************
  230. X*** 251,257
  231. X  get_intermediatepoint(x, y)
  232. X  int    x, y;
  233. X  {
  234. X!     draw_elasticline();  /* erase elastic line */
  235. X      cur_x = x;
  236. X      cur_y = y;
  237. X      if (cur_command == F_POLYLINE || cur_command == F_POLYGON)
  238. X
  239. X--- 252,258 -----
  240. X  get_intermediatepoint(x, y)
  241. X  int    x, y;
  242. X  {
  243. X!     draw_elasticline();    /* erase elastic line */
  244. X      cur_x = x;
  245. X      cur_y = y;
  246. X      draw_elasticline();
  247. X***************
  248. X*** 254,264
  249. X      draw_elasticline();  /* erase elastic line */
  250. X      cur_x = x;
  251. X      cur_y = y;
  252. X!     if (cur_command == F_POLYLINE || cur_command == F_POLYGON)
  253. X!         draw_line_segment(cur_line_style, cur_styleval, fix_x, fix_y, x, y, 
  254. X!                 PAINT, line_thickness);
  255. X!     else
  256. X!         draw_elasticline();
  257. X      num_point++;
  258. X      fix_x = x;
  259. X      fix_y = y;
  260. X
  261. X--- 255,261 -----
  262. X      draw_elasticline();    /* erase elastic line */
  263. X      cur_x = x;
  264. X      cur_y = y;
  265. X!     draw_elasticline();
  266. X      num_point++;
  267. X      fix_x = x;
  268. X      fix_y = y;
  269. X***************
  270. X*** 317,325
  271. X          return;
  272. X          }
  273. X      line->type = T_POLYLINE;
  274. X!     line->style = cur_line_style;
  275. X!     line->thickness = line_thickness;
  276. X!     line->style_val = cur_styleval;
  277. X      line->color = cur_color;
  278. X      line->depth = 0;
  279. X      line->area_fill = 0;
  280. X
  281. X--- 314,322 -----
  282. X          return;
  283. X          }
  284. X      line->type = T_POLYLINE;
  285. X!     line->style = SOLID_LINE;
  286. X!     line->thickness = 1;        /* these will be changed to final values */
  287. X!     line->style_val = 0;
  288. X      line->color = cur_color;
  289. X      line->depth = 0;
  290. X      line->area_fill = 0;
  291. X***************
  292. X*** 328,334
  293. X      line->next = NULL;
  294. X      line->for_arrow = NULL;
  295. X      line->back_arrow = NULL;
  296. X!     if (cur_command == F_POLYGON) {
  297. X          if (num_point >= 3) {
  298. X          line->type = T_POLYGON;
  299. X          num_point++;
  300. X
  301. X--- 325,331 -----
  302. X      line->next = NULL;
  303. X      line->for_arrow = NULL;
  304. X      line->back_arrow = NULL;
  305. X!     if (cur_command == F_POLYGON) {  /* polygon; close it off with one more point */
  306. X          if (num_point >= 3) {
  307. X          line->type = T_POLYGON;
  308. X          num_point++;
  309. X***************
  310. X*** 333,343
  311. X          line->type = T_POLYGON;
  312. X          num_point++;
  313. X          append_point(firstx, firsty, &cur_point);
  314. X!         /* added 3/1/89 B.V.Smith */
  315. X!         line->area_fill = fill_mode? cur_areafill : 0;
  316. X!         fill_object(line,PAINT);
  317. X!         draw_line_segment(cur_line_style, cur_styleval, 
  318. X!             firstx, firsty, fix_x, fix_y, PAINT, line_thickness);
  319. X          }
  320. X          }
  321. X      else if (dot) {
  322. X
  323. X--- 330,339 -----
  324. X          line->type = T_POLYGON;
  325. X          num_point++;
  326. X          append_point(firstx, firsty, &cur_point);
  327. X!         draw_elasticline();
  328. X!         fix_x=firstx;
  329. X!         fix_y=firsty;
  330. X!         draw_elasticline();        /* fix last elastic line */
  331. X          }
  332. X          }
  333. X      else if (dot) {            /* single point */
  334. X***************
  335. X*** 340,347
  336. X              firstx, firsty, fix_x, fix_y, PAINT, line_thickness);
  337. X          }
  338. X          }
  339. X!     else if (dot) {
  340. X!         pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 1);
  341. X          line->style = SOLID_LINE;
  342. X          }
  343. X      else if (num_point > 1) {
  344. X
  345. X--- 336,343 -----
  346. X          draw_elasticline();        /* fix last elastic line */
  347. X          }
  348. X          }
  349. X!     else if (dot) {            /* single point */
  350. X!         pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 2, SOLID_LINE, 0.0);
  351. X          line->style = SOLID_LINE;
  352. X          }
  353. X      else if (num_point > 1) {        /* polyline; draw any arrows */
  354. X***************
  355. X*** 344,350
  356. X          pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 1);
  357. X          line->style = SOLID_LINE;
  358. X          }
  359. X!     else if (num_point > 1) {
  360. X          if (autoforwardarrow_mode) {
  361. X          line->for_arrow = forward_arrow();
  362. X          for (p = line->points; p != cur_point; q = p, p = p->next);
  363. X
  364. X--- 340,346 -----
  365. X          pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 2, SOLID_LINE, 0.0);
  366. X          line->style = SOLID_LINE;
  367. X          }
  368. X!     else if (num_point > 1) {        /* polyline; draw any arrows */
  369. X          if (autoforwardarrow_mode) {
  370. X          line->for_arrow = forward_arrow();
  371. X          for (p = line->points; p != cur_point; q = p, p = p->next);
  372. X***************
  373. X*** 356,361
  374. X          draw_arrow(p->x, p->y, firstx, firsty, line->back_arrow, PAINT);
  375. X          }
  376. X          }
  377. X      clean_up();
  378. X      set_action_object(F_CREATE, O_POLYLINE);
  379. X      insert_line(&objects.lines, line);
  380. X
  381. X--- 352,369 -----
  382. X          draw_arrow(p->x, p->y, firstx, firsty, line->back_arrow, PAINT);
  383. X          }
  384. X          }
  385. X+     if (!dot)
  386. X+         {
  387. X+         line->thickness = 1;
  388. X+         line->area_fill = 0;
  389. X+         draw_line(line,INV_PAINT);    /* erase temporary outline */
  390. X+         line->thickness = line_thickness;
  391. X+         line->area_fill = fill_mode? cur_areafill : 0;
  392. X+         line->thickness = line_thickness;
  393. X+         line->style = line_style;
  394. X+         line->style_val = cur_styleval;
  395. X+         draw_line(line,PAINT);        /* draw final */
  396. X+         }
  397. X      clean_up();
  398. X      set_action_object(F_CREATE, O_POLYLINE);
  399. X      insert_line(&objects.lines, line);
  400. X***************
  401. X*** 391,397
  402. X      XPoint *points;
  403. X      GC gc;
  404. X  
  405. X!     if (line->area_fill == 0)
  406. X          return;
  407. X  
  408. X      if (op == PAINT)        /* fill */
  409. X
  410. X--- 399,405 -----
  411. X      XPoint *points;
  412. X      GC gc;
  413. X  
  414. X!     if (line->area_fill <= 0)
  415. X          return;
  416. X  
  417. X      if (op == PAINT)        /* fill */
  418. X***************
  419. X*** 399,404
  420. X      else                /* un-fill */
  421. X          gc = un_fill_gc[line->area_fill-1];
  422. X  
  423. X      npts=0;
  424. X      /* count number of points in this object */
  425. X      for (pnt=line->points; pnt != NULL; pnt = pnt->next)
  426. X
  427. X--- 407,417 -----
  428. X      else                /* un-fill */
  429. X          gc = un_fill_gc[line->area_fill-1];
  430. X  
  431. X+     if (line->type == T_ARC_BOX)
  432. X+         {
  433. X+         fill_arc_box(line,gc);
  434. X+         return;
  435. X+         }
  436. X      npts=0;
  437. X      /* count number of points in this object */
  438. X      for (pnt=line->points; pnt != NULL; pnt = pnt->next)
  439. X***************
  440. X*** 416,419
  441. X      XFillPolygon(tool_d,canvas_pixwin,gc,points, npts,
  442. X              Complex, CoordModeOrigin);
  443. X      free(points);
  444. X      }
  445. X
  446. X--- 429,485 -----
  447. X      XFillPolygon(tool_d,canvas_pixwin,gc,points, npts,
  448. X              Complex, CoordModeOrigin);
  449. X      free(points);
  450. X+     }
  451. X+ 
  452. X+ fill_arc_box(line, gc)
  453. X+ F_line *line;
  454. X+ GC gc;
  455. X+     {
  456. X+     F_point    *point;
  457. X+     int    xmin,xmax,ymin,ymax;
  458. X+     int    radius,diam;
  459. X+ 
  460. X+     point = line->points;
  461. X+     radius = line->pen;
  462. X+ 
  463. X+     xmin = xmax = point->x;
  464. X+     ymin = ymax = point->y;
  465. X+     while (point->next)        /* find lower left (upper-left on screen) */
  466. X+         {            /* and upper right (lower right on screen) */
  467. X+         point = point->next;
  468. X+         if (point->x < xmin)
  469. X+             xmin = point->x;
  470. X+         else if (point->x > xmax)
  471. X+             xmax = point->x;
  472. X+         if (point->y < ymin)
  473. X+             ymin = point->y;
  474. X+         else if (point->y > ymax)
  475. X+             ymax = point->y;
  476. X+         }
  477. X+     
  478. X+     diam = 2*radius;
  479. X+     /* upper left */
  480. X+     XFillArc(tool_d, canvas_pixwin, gc, xmin, ymin,
  481. X+             diam, diam, 90*64, 90*64);
  482. X+     /* lower left */
  483. X+     XFillArc(tool_d, canvas_pixwin, gc, xmin, ymax-diam,
  484. X+             diam, diam, 180*64, 90*64);
  485. X+     /* lower right */
  486. X+     XFillArc(tool_d, canvas_pixwin, gc, xmax-diam, ymax-diam,
  487. X+             diam, diam, 270*64, 90*64);
  488. X+     /* upper right */
  489. X+     XFillArc(tool_d, canvas_pixwin, gc, xmax-diam, ymin,
  490. X+             diam, diam, 0*64, 90*64);
  491. X+     /* fill strip on left side between upper and lower arcs */
  492. X+     if (ymax-ymin-diam > 0)
  493. X+         XFillRectangle(tool_d, canvas_pixwin, gc, xmin, ymin+radius,
  494. X+             radius, ymax-ymin-diam);
  495. X+     /* fill middle section */
  496. X+     if (xmax-xmin-diam > 0)
  497. X+         XFillRectangle(tool_d, canvas_pixwin, gc, xmin+radius, ymin,
  498. X+             xmax-xmin-diam, ymax-ymin);
  499. X+     /* fill strip on right side between upper and lower arcs */
  500. X+     if (ymax-ymin-diam > 0)
  501. X+         XFillRectangle(tool_d, canvas_pixwin, gc, xmax-radius, ymin+radius,
  502. X+             radius, ymax-ymin-diam);
  503. X      }
  504. END_OF_FILE
  505. if test 13070 -ne `wc -c <'line.c.diff'`; then
  506.     echo shar: \"'line.c.diff'\" unpacked with wrong size!
  507. fi
  508. # end of 'line.c.diff'
  509. fi
  510. if test -f 'main.c.diff' -a "${1}" != "-c" ; then 
  511.   echo shar: Will not clobber existing file \"'main.c.diff'\"
  512. else
  513. echo shar: Extracting \"'main.c.diff'\" \(11037 characters\)
  514. sed "s/^X//" >'main.c.diff' <<'END_OF_FILE'
  515. X*** main.c.p5    Tue Mar 13 10:19:02 1990
  516. X--- main.c    Fri Mar 23 09:32:43 1990
  517. X***************
  518. X*** 25,47 ****
  519. X  extern int        SIDERULER_START;
  520. X  extern int        TOPRULER_LEFT, TOPRULER_TOP;
  521. X  extern int        TOPRULER_WIDTH, TOPRULER_HEIGHT;
  522. X- extern int        INCHES;
  523. X  extern            (*canvas_rightbut_proc)();
  524. X  extern            set_popupmenu();
  525. X  extern int        cur_areafill;
  526. X- extern int        landscape;
  527. X  extern int        print_landscape;
  528. X  extern int        size_button;
  529. X  
  530. X  #include "fig.icon.X"
  531. X  Pixmap        fig_icon;
  532. X- extern char    *boldFont;
  533. X- extern char    *normalFont;
  534. X  
  535. X- #define            SCREEN_WIDTH        1152    /* only used in Sunview */
  536. X- #define            SCREEN_HEIGHT        900
  537. X- #define            min(a,b)        (((a) < (b)) ? (a) : (b))
  538. X- 
  539. X  static char    tool_name[100] = " FIG : FACILITY FOR INTERACTIVE GENERATION OF FIGURES ";
  540. X  static RECT        icon_rect, tool_rect;
  541. X  static            sigwinched();
  542. X--- 25,39 ----
  543. X***************
  544. X*** 48,57 ****
  545. X  
  546. X  /************** FIG options ******************/
  547. X  
  548. X! extern int        DEBUG;
  549. X! extern int        RHS_PANEL;
  550. X! extern int        INVERSE;
  551. X! extern int        TRACKING;
  552. X  
  553. X  TOOL            tool;
  554. X  int            WINDOW_WIDTH, WINDOW_HEIGHT;
  555. X--- 40,46 ----
  556. X  
  557. X  /************** FIG options ******************/
  558. X  
  559. X! extern    appresStruct    appres;
  560. X  
  561. X  TOOL            tool;
  562. X  int            WINDOW_WIDTH, WINDOW_HEIGHT;
  563. X***************
  564. X*** 58,89 ****
  565. X  char            file_header[32] = "#FIG ";
  566. X  static char        *file = NULL;
  567. X  
  568. X! static int    true = True;
  569. X! static int    false = False;
  570. X  static int    zero = 0;
  571. X- static float    tmp_width = 0.0, tmp_height = 0.0;
  572. X  
  573. X  static XtResource application_resources[] = {
  574. X!     {XtNjustify, XtCJustify, XtRBoolean, sizeof(int),
  575. X!          (Cardinal)&RHS_PANEL, XtRBoolean, (caddr_t)&false},
  576. X!     {"debug", "Debug", XtRBoolean, sizeof(int),
  577. X!          (Cardinal)&DEBUG, XtRBoolean, (caddr_t)&false},
  578. X!     {"landscape", XtCOrientation, XtRBoolean, sizeof(int),
  579. X!          (Cardinal)&landscape, XtRBoolean, (caddr_t)&true},
  580. X!     {XtNwidth, XtCWidth, XtRFloat, sizeof(float),
  581. X!          (Cardinal)&tmp_width, XtRInt, (caddr_t)&zero},
  582. X!     {XtNheight, XtCHeight, XtRFloat, sizeof(float),
  583. X!          (Cardinal)&tmp_height, XtRInt, (caddr_t)&zero},
  584. X!     {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(int),
  585. X!          (Cardinal)&INVERSE, XtRBoolean, (caddr_t)&false},
  586. X!     {"trackCursor", "Track", XtRBoolean, sizeof(int),
  587. X!          (Cardinal)&TRACKING, XtRBoolean, (caddr_t)&false},
  588. X!      {"inches", "Inches", XtRBoolean, sizeof(int),
  589. X!           (Cardinal)&INCHES, XtRBoolean, (caddr_t)&true},
  590. X!     {"boldFont", "BoldFont", XtRString, sizeof(caddr_t),
  591. X!         (Cardinal)&boldFont, XtRString, (caddr_t)NULL},
  592. X!     {"normalFont", "NormalFont", XtRString, sizeof(caddr_t),
  593. X!         (Cardinal)&normalFont, XtRString, (caddr_t)NULL},    
  594. X  };
  595. X  
  596. X  static XrmOptionDescRec options[] =
  597. X--- 47,77 ----
  598. X  char            file_header[32] = "#FIG ";
  599. X  static char        *file = NULL;
  600. X  
  601. X! static Boolean    true = True;
  602. X! static Boolean    false = False;
  603. X  static int    zero = 0;
  604. X  
  605. X  static XtResource application_resources[] = {
  606. X!     {XtNjustify, XtCJustify, XtRBoolean, sizeof(Boolean),
  607. X!          XtOffset(appresPtr, RHS_PANEL), XtRBoolean, (caddr_t)&false},
  608. X!     {"landscape", XtCOrientation, XtRBoolean, sizeof(Boolean),
  609. X!          XtOffset(appresPtr, landscape), XtRBoolean, (caddr_t)&true},
  610. X!     {"debug", "Debug", XtRBoolean, sizeof(Boolean),
  611. X!          XtOffset(appresPtr, DEBUG), XtRBoolean, (caddr_t)&false},
  612. X!     {"pwidth", XtCWidth, XtRFloat, sizeof(float),
  613. X!          XtOffset(appresPtr, tmp_width), XtRInt, (caddr_t)&zero},
  614. X!     {"pheight", XtCHeight, XtRFloat, sizeof(float),
  615. X!          XtOffset(appresPtr, tmp_height), XtRInt, (caddr_t)&zero},
  616. X!     {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(Boolean),
  617. X!          XtOffset(appresPtr, INVERSE), XtRBoolean, (caddr_t)&false},
  618. X!     {"trackCursor", "Track", XtRBoolean, sizeof(Boolean),
  619. X!          XtOffset(appresPtr, TRACKING), XtRBoolean, (caddr_t)&true},
  620. X!      {"inches", "Inches", XtRBoolean, sizeof(Boolean),
  621. X!           XtOffset(appresPtr, INCHES), XtRBoolean, (caddr_t)&true},
  622. X!     {"boldFont", "BoldFont", XtRString, sizeof(char *),
  623. X!         XtOffset(appresPtr, boldFont), XtRString, (caddr_t)NULL},
  624. X!     {"normalFont", "NormalFont", XtRString, sizeof(char *),
  625. X!         XtOffset(appresPtr, normalFont), XtRString, (caddr_t)NULL},
  626. X  };
  627. X  
  628. X  static XrmOptionDescRec options[] =
  629. X***************
  630. X*** 95,102 ****
  631. X      {"-Landscape", ".landscape", XrmoptionNoArg, "True"},
  632. X      {"-portrait", ".landscape", XrmoptionNoArg, "False"},
  633. X      {"-Portrait", ".landscape", XrmoptionNoArg, "False"},
  634. X!     {"-width", ".width", XrmoptionSepArg, 0},
  635. X!     {"-height", ".height", XrmoptionSepArg, 0},
  636. X      {"-inverse", ".reverseVideo", XrmoptionNoArg, "True"},
  637. X      {"-notrack", ".trackCursor", XrmoptionNoArg, "False"},
  638. X      {"-track", ".trackCursor", XrmoptionNoArg, "True"},
  639. X--- 83,90 ----
  640. X      {"-Landscape", ".landscape", XrmoptionNoArg, "True"},
  641. X      {"-portrait", ".landscape", XrmoptionNoArg, "False"},
  642. X      {"-Portrait", ".landscape", XrmoptionNoArg, "False"},
  643. X!     {"-pwidth", ".pwidth", XrmoptionSepArg, 0},
  644. X!     {"-pheight", ".pheight", XrmoptionSepArg, 0},
  645. X      {"-inverse", ".reverseVideo", XrmoptionNoArg, "True"},
  646. X      {"-notrack", ".trackCursor", XrmoptionNoArg, "False"},
  647. X      {"-track", ".trackCursor", XrmoptionNoArg, "True"},
  648. X***************
  649. X*** 117,122 ****
  650. X--- 105,111 ----
  651. X  {
  652. X      { XtNcallback, (XtArgVal)callbacks },
  653. X      { XtNinput, (XtArgVal) TRUE },
  654. X+     { XtNdefaultDistance, (XtArgVal) 1 },
  655. X  };
  656. X  
  657. X  main(argc,argv)
  658. X***************
  659. X*** 129,134 ****
  660. X--- 118,124 ----
  661. X      int        ichild;
  662. X      char        tstr[10];
  663. X      XWMHints    *wmhints;
  664. X+     char        i;
  665. X  
  666. X      strcat(tool_name, " V. ");
  667. X      strcat(tool_name, FIG_VERSION);
  668. X***************
  669. X*** 144,168 ****
  670. X          &argc, argv);
  671. X  
  672. X      fix_converters();
  673. X!     XtGetApplicationResources(tool, 0, application_resources,
  674. X!                                    XtNumber(application_resources), NULL, 0 );
  675. X!     if (argc > 1)
  676. X!         file = argv[1];
  677. X  
  678. X!     print_landscape = landscape;    /* match print and screen format to start */
  679. X  
  680. X      tool_d = XtDisplay(tool);
  681. X      tool_s = XtScreen(tool);
  682. X      tool_sn = DefaultScreen(tool_d);
  683. X      
  684. X!     if( CellsOfScreen(tool_s) == 2 && INVERSE )
  685. X      {
  686. X          XrmValue    value;
  687. X!         XrmDatabase newdb = (XrmDatabase) 0;
  688. X!         /* extern XrmDatabase XtDefaultDB; */
  689. X!         extern XrmDatabase XtDatabase();
  690. X  
  691. X-         /* XtDefaultDB = XtDatabase(tool_d); */
  692. X          value.size = sizeof("White");
  693. X          value.addr = "White";
  694. X          XrmPutResource(&newdb, "xfig*borderColor", "String",
  695. X--- 134,172 ----
  696. X          &argc, argv);
  697. X  
  698. X      fix_converters();
  699. X!     XtGetApplicationResources(tool, &appres, application_resources, 
  700. X!             10, NULL, 0 );
  701. X!     
  702. X!     i=1;
  703. X!     while (argc-- > 1)
  704. X!         {
  705. X!         if (*argv[i] != '-')    /* search for non - name */
  706. X!         {
  707. X!         file = argv[i];
  708. X!         break;
  709. X!         }
  710. X!         i++;
  711. X!         }
  712. X  
  713. X!     print_landscape = appres.landscape; /* match print and screen format to start */
  714. X  
  715. X      tool_d = XtDisplay(tool);
  716. X      tool_s = XtScreen(tool);
  717. X      tool_sn = DefaultScreen(tool_d);
  718. X      
  719. X!     /* run synchronously for debugging */
  720. X! 
  721. X!     if (appres.DEBUG)
  722. X!         {
  723. X!         XSynchronize(tool_d, 1);
  724. X!         fprintf(stderr,"Debug mode, running synchronously\n");
  725. X!         }
  726. X! 
  727. X!     if( CellsOfScreen(tool_s) == 2 && appres.INVERSE )
  728. X      {
  729. X          XrmValue    value;
  730. X!         XrmDatabase newdb = (XrmDatabase) 0, old;
  731. X  
  732. X          value.size = sizeof("White");
  733. X          value.addr = "White";
  734. X          XrmPutResource(&newdb, "xfig*borderColor", "String",
  735. X***************
  736. X*** 175,182 ****
  737. X          value.addr = "Black";
  738. X          XrmPutResource(&newdb, "xfig*background", "String",
  739. X                     &value);
  740. X!         /* XrmMergeDatabases(newdb, &XtDefaultDB); */
  741. X!         XrmMergeDatabases(newdb, XtDatabase(tool_d));
  742. X  
  743. X          /* now set the tool part, since its already created */
  744. X          XtSetArg(tmp_arg[0], XtNborderColor,
  745. X--- 179,186 ----
  746. X          value.addr = "Black";
  747. X          XrmPutResource(&newdb, "xfig*background", "String",
  748. X                     &value);
  749. X!         old = XtDatabase(tool_d);
  750. X!         XrmMergeDatabases(newdb, &old);
  751. X  
  752. X          /* now set the tool part, since its already created */
  753. X          XtSetArg(tmp_arg[0], XtNborderColor,
  754. X***************
  755. X*** 205,218 ****
  756. X          size_button = DEF_PRINTFONTSIZE;
  757. X  
  758. X      ICON_COLUMN = ICON_COLUMN_PORT;
  759. X!     CANVAS_WIDTH = tmp_width * (INCHES ? PIX_PER_INCH : PIX_PER_CM);
  760. X!     CANVAS_HEIGHT = tmp_height * (INCHES ? PIX_PER_INCH : PIX_PER_CM);
  761. X  
  762. X      if( CANVAS_WIDTH == 0 )
  763. X!         CANVAS_WIDTH = landscape ? DEF_CANVAS_WIDTH_L : DEF_CANVAS_WIDTH_P;
  764. X      
  765. X      if( CANVAS_HEIGHT == 0 )
  766. X!         CANVAS_HEIGHT = landscape ? DEF_CANVAS_HEIGHT_L : DEF_CANVAS_HEIGHT_P;
  767. X      
  768. X      
  769. X      if( (CANVAS_HEIGHT < DEF_CANVAS_HEIGHT_P) ||
  770. X--- 209,222 ----
  771. X          size_button = DEF_PRINTFONTSIZE;
  772. X  
  773. X      ICON_COLUMN = ICON_COLUMN_PORT;
  774. X!     CANVAS_WIDTH = appres.tmp_width * (appres.INCHES ? PIX_PER_INCH : PIX_PER_CM);
  775. X!     CANVAS_HEIGHT = appres.tmp_height * (appres.INCHES ? PIX_PER_INCH : PIX_PER_CM);
  776. X  
  777. X      if( CANVAS_WIDTH == 0 )
  778. X!         CANVAS_WIDTH = appres.landscape ? DEF_CANVAS_WIDTH_L : DEF_CANVAS_WIDTH_P;
  779. X      
  780. X      if( CANVAS_HEIGHT == 0 )
  781. X!         CANVAS_HEIGHT = appres.landscape ? DEF_CANVAS_HEIGHT_L : DEF_CANVAS_HEIGHT_P;
  782. X      
  783. X      
  784. X      if( (CANVAS_HEIGHT < DEF_CANVAS_HEIGHT_P) ||
  785. X***************
  786. X*** 233,241 ****
  787. X      children[ichild++] = panel_sw;
  788. X      children[ichild++] = topruler_sw;
  789. X      children[ichild++] = psfont;        /* shows current printer font name */
  790. X      children[ichild++] = canvas_sw;        /* main drawing canvas */
  791. X      children[ichild++] = msg_sw;        /* message window */
  792. X-     children[ichild++] = sideruler_sw;    /* side ruler */
  793. X      children[ichild++] = panel2_sw;        /* lower button panel */
  794. X      children[ichild++] = ind_box;        /* fill/line/radius indicators */
  795. X  
  796. X--- 237,245 ----
  797. X      children[ichild++] = panel_sw;
  798. X      children[ichild++] = topruler_sw;
  799. X      children[ichild++] = psfont;        /* shows current printer font name */
  800. X+     children[ichild++] = sideruler_sw;    /* side ruler */
  801. X      children[ichild++] = canvas_sw;        /* main drawing canvas */
  802. X      children[ichild++] = msg_sw;        /* message window */
  803. X      children[ichild++] = panel2_sw;        /* lower button panel */
  804. X      children[ichild++] = ind_box;        /* fill/line/radius indicators */
  805. X  
  806. X***************
  807. X*** 251,264 ****
  808. X      wmhints->input = True;
  809. X      XSetWMHints(tool_d, XtWindow(tool),wmhints);
  810. X  
  811. X!     if( RHS_PANEL )        /* side button panel is on right size */
  812. X      {
  813. X          XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
  814. X          XtSetArg(tmp_arg[1], XtNhorizDistance, RULER_WIDTH+2);
  815. X          XtSetValues(topruler_sw, tmp_arg, 2);
  816. X          XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
  817. X          XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
  818. X!         XtSetValues(sideruler_sw, tmp_arg, 2);
  819. X          XtUnmanageChild(msg_sw);
  820. X          XtSetArg(tmp_arg[0], XtNfromHoriz, sideruler_sw);
  821. X          XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
  822. X--- 255,272 ----
  823. X      wmhints->input = True;
  824. X      XSetWMHints(tool_d, XtWindow(tool),wmhints);
  825. X  
  826. X!     if( appres.RHS_PANEL )        /* side button panel is on right size */
  827. X      {
  828. X          XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
  829. X          XtSetArg(tmp_arg[1], XtNhorizDistance, RULER_WIDTH+2);
  830. X          XtSetValues(topruler_sw, tmp_arg, 2);
  831. X+ 
  832. X          XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
  833. X          XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
  834. X!         XtSetArg(tmp_arg[2], XtNleft, XtChainLeft); /* chain to left of form */
  835. X!         XtSetArg(tmp_arg[3], XtNright, XtChainLeft);
  836. X!         XtSetValues(sideruler_sw, tmp_arg, 4);
  837. X! 
  838. X          XtUnmanageChild(msg_sw);
  839. X          XtSetArg(tmp_arg[0], XtNfromHoriz, sideruler_sw);
  840. X          XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
  841. END_OF_FILE
  842. if test 11037 -ne `wc -c <'main.c.diff'`; then
  843.     echo shar: \"'main.c.diff'\" unpacked with wrong size!
  844. fi
  845. # end of 'main.c.diff'
  846. fi
  847. if test -f 'ruler.c.diff' -a "${1}" != "-c" ; then 
  848.   echo shar: Will not clobber existing file \"'ruler.c.diff'\"
  849. else
  850. echo shar: Extracting \"'ruler.c.diff'\" \(15556 characters\)
  851. sed "s/^X//" >'ruler.c.diff' <<'END_OF_FILE'
  852. X*** ruler.c.p5    Tue Jan 16 17:21:03 1990
  853. X--- ruler.c    Thu Mar 22 17:30:36 1990
  854. X***************
  855. X*** 13,24 ****
  856. X  #include "font.h"
  857. X  #include "paintop.h"
  858. X  
  859. X! #define            INCH_MARK        12
  860. X! #define            HALF_MARK        11
  861. X! #define            QUARTER_MARK        8
  862. X! #define            SIXTEENTH_MARK        6
  863. X  
  864. X- #define            MARK_HT            5
  865. X  #define            TRM_WID            16
  866. X  #define            TRM_HT            8
  867. X  #define            SRM_WID            8
  868. X--- 13,23 ----
  869. X  #include "font.h"
  870. X  #include "paintop.h"
  871. X  
  872. X! #define            INCH_MARK        8
  873. X! #define            HALF_MARK        8
  874. X! #define            QUARTER_MARK        6
  875. X! #define            SIXTEENTH_MARK        4
  876. X  
  877. X  #define            TRM_WID            16
  878. X  #define            TRM_HT            8
  879. X  #define            SRM_WID            8
  880. X***************
  881. X*** 30,38 ****
  882. X  extern int        SIDERULER_HEIGHT, SIDERULER_START;
  883. X  extern int        TOPRULER_LEFT, TOPRULER_TOP;
  884. X  extern            null_proc();
  885. X! extern int        RHS_PANEL;
  886. X! extern int        TRACKING;
  887. X! extern int        INCHES;
  888. X  
  889. X  static            lasty = -100;
  890. X  static            lastx = -100;
  891. X--- 29,35 ----
  892. X  extern int        SIDERULER_HEIGHT, SIDERULER_START;
  893. X  extern int        TOPRULER_LEFT, TOPRULER_TOP;
  894. X  extern            null_proc();
  895. X! extern appresStruct    appres;
  896. X  
  897. X  static            lasty = -100;
  898. X  static            lastx = -100;
  899. X***************
  900. X*** 41,73 ****
  901. X                      "6", "7", "8", "9", "10", "11" };
  902. X  static int        troffx = -7, troffy = -10;
  903. X  static char        tr_marker_image[16] = {
  904. X!                 0xFF, 0xFE,    /* *************** */
  905. X!                 0x7F, 0xFC,    /*  *************  */
  906. X!                 0x3F, 0xF8,    /*   ***********   */
  907. X!                 0x1F, 0xF0,    /*    *********    */
  908. X!                 0x0F, 0xE0,    /*     *******     */
  909. X!                 0x07, 0xC0,    /*      *****      */
  910. X!                 0x03, 0x80,    /*       ***       */
  911. X!                 0x01, 0x00    /*        *        */
  912. X                  };
  913. X  static            mpr_static(trm_pr, TRM_WID, TRM_HT, 1, tr_marker_image);
  914. X  static int        srroffx = 2, srroffy = -7;
  915. X  static char        srr_marker_image[16] = {
  916. X!                 0x01,    /*          *  */
  917. X!                 0x03,    /*         **  */
  918. X!                 0x07,    /*        ***  */
  919. X!                 0x0F,    /*       ****  */
  920. X!                 0x1F,    /*      *****  */
  921. X!                 0x3F,    /*     ******  */
  922. X!                 0x7F,    /*    *******  */
  923. X!                 0xFF,    /*   ********  */
  924. X!                 0x7F,    /*    *******  */
  925. X!                 0x3F,    /*     ******  */
  926. X!                 0x1F,    /*      *****  */
  927. X!                 0x0F,    /*       ****  */
  928. X!                 0x07,    /*        ***  */
  929. X!                 0x03,    /*         **  */
  930. X!                 0x01,    /*          *  */
  931. X                  0x00
  932. X                  };
  933. X  static        mpr_static(srrm_pr, SRM_WID, SRM_HT, 1, srr_marker_image);
  934. X--- 38,70 ----
  935. X                      "6", "7", "8", "9", "10", "11" };
  936. X  static int        troffx = -7, troffy = -10;
  937. X  static char        tr_marker_image[16] = {
  938. X!                 0xFE, 0xFF, /* *************** */
  939. X!                 0xFC, 0x7F, /*  *************  */
  940. X!                 0xF8, 0x3F, /*   ***********   */
  941. X!                 0xF0, 0x1F, /*    *********    */
  942. X!                 0xE0, 0x0F, /*     *******     */
  943. X!                 0xC0, 0x07, /*      *****      */
  944. X!                 0x80, 0x03, /*       ***       */
  945. X!                 0x00, 0x01, /*        *        */
  946. X                  };
  947. X  static            mpr_static(trm_pr, TRM_WID, TRM_HT, 1, tr_marker_image);
  948. X  static int        srroffx = 2, srroffy = -7;
  949. X  static char        srr_marker_image[16] = {
  950. X!                 0x80,     /*          *  */
  951. X!                 0xC0,     /*         **  */
  952. X!                 0xE0,     /*        ***  */
  953. X!                 0xF0,     /*       ****  */
  954. X!                 0xF8,     /*      *****  */
  955. X!                 0xFC,     /*     ******  */
  956. X!                 0xFE,     /*    *******  */
  957. X!                 0xFF,     /*   ********  */
  958. X!                 0xFE,     /*    *******  */
  959. X!                 0xFC,     /*     ******  */
  960. X!                 0xF8,     /*      *****  */
  961. X!                 0xF0,     /*       ****  */
  962. X!                 0xE0,     /*        ***  */
  963. X!                 0xC0,     /*         **  */
  964. X!                 0x80,     /*          *  */
  965. X                  0x00
  966. X                  };
  967. X  static        mpr_static(srrm_pr, SRM_WID, SRM_HT, 1, srr_marker_image);
  968. X***************
  969. X*** 74,94 ****
  970. X  
  971. X  static int        srloffx = -10, srloffy = -7;
  972. X  static char        srl_marker_image[16] = {
  973. X!                 0x80,    /*  *          */
  974. X!                 0xC0,    /*  **         */
  975. X!                 0xE0,    /*  ***        */
  976. X!                 0xF0,    /*  ****       */
  977. X!                 0xF8,    /*  *****      */
  978. X!                 0xFC,    /*  ******     */
  979. X!                 0xFE,    /*  *******    */
  980. X                  0xFF,    /*  ********   */
  981. X!                 0xFE,    /*  *******    */
  982. X!                 0xFC,    /*  ******     */
  983. X!                 0xF8,    /*  *****      */
  984. X!                 0xF0,    /*  ****       */
  985. X!                 0xE0,    /*  ***        */
  986. X!                 0xC0,    /*  **         */
  987. X!                 0x80,    /*  *          */
  988. X                  0x00
  989. X                  };
  990. X  static        mpr_static(srlm_pr, SRM_WID, SRM_HT, 1, srl_marker_image);
  991. X--- 71,91 ----
  992. X  
  993. X  static int        srloffx = -10, srloffy = -7;
  994. X  static char        srl_marker_image[16] = {
  995. X!                 0x01,    /*  *          */
  996. X!                 0x03,    /*  **         */
  997. X!                 0x07,    /*  ***        */
  998. X!                 0x0F,    /*  ****       */
  999. X!                 0x1F,    /*  *****      */
  1000. X!                 0x3F,    /*  ******     */
  1001. X!                 0x7F,    /*  *******    */
  1002. X                  0xFF,    /*  ********   */
  1003. X!                 0x7F,    /*  *******    */
  1004. X!                 0x3F,    /*  ******     */
  1005. X!                 0x1F,    /*  *****      */
  1006. X!                 0x0F,    /*  ****       */
  1007. X!                 0x07,    /*  ***        */
  1008. X!                 0x03,    /*  **         */
  1009. X!                 0x01,    /*  *          */
  1010. X                  0x00
  1011. X                  };
  1012. X  static        mpr_static(srlm_pr, SRM_WID, SRM_HT, 1, srl_marker_image);
  1013. X***************
  1014. X*** 109,146 ****
  1015. X  
  1016. X  static Arg    ruler_args[] =
  1017. X  {
  1018. X!     /*  0 */ { XtNx, (XtArgVal)0 },
  1019. X!     /*  1 */ { XtNy, (XtArgVal)0 },
  1020. X!     /*  2 */ { XtNwidth, (XtArgVal)0 },
  1021. X!     /*  3 */ { XtNheight, (XtArgVal)0 },
  1022. X!     /*  4 */ { XtNlabel, (XtArgVal)"" },
  1023. X!     /*  5 */ { XtNfromHoriz, (XtArgVal)NULL },
  1024. X!     /*  6 */ { XtNhorizDistance, (XtArgVal)0 },
  1025. X!     /*  7 */ { XtNfromVert, (XtArgVal)NULL },
  1026. X!     /*  8 */ { XtNvertDistance, (XtArgVal)0 },
  1027. X!     /*  9 */ { XtNresizable, (XtArgVal)FALSE },
  1028. X!     /* 10 */ { XtNtop, (XtArgVal)XtRubber },
  1029. X!     /* 11 */ { XtNbottom, (XtArgVal)XtRubber },
  1030. X!     /* 12 */ { XtNleft, (XtArgVal)XtRubber },
  1031. X!     /* 13 */ { XtNright, (XtArgVal)XtRubber },
  1032. X  };
  1033. X  
  1034. X  extern int    SIDERULER_WIDTH, SIDERULER_HEIGHT;
  1035. X  extern int    TOPRULER_WIDTH, TOPRULER_HEIGHT;
  1036. X  
  1037. X! int init_sideruler(tool)
  1038. X      TOOL        tool;
  1039. X  {
  1040. X!     ruler_args[2].value = SIDERULER_WIDTH = RULER_WIDTH;
  1041. X!     ruler_args[3].value = SIDERULER_HEIGHT = CANVAS_HEIGHT;
  1042. X!     ruler_args[5].value = (XtArgVal)canvas_sw;
  1043. X!     ruler_args[7].value = (XtArgVal)topruler_sw;
  1044. X      /* Place the sideruler below the topruler, next to the canvas,
  1045. X         but fixed offset from the top of the form */
  1046. X!     ruler_args[10].value = (XtArgVal)XtChainTop;
  1047. X!     ruler_args[11].value = (XtArgVal)XtRubber;
  1048. X!     ruler_args[12].value = (XtArgVal)XtRubber;
  1049. X!     ruler_args[13].value = (XtArgVal)XtRubber;
  1050. X      
  1051. X      sideruler_sw = XtCreateWidget("sruler", labelWidgetClass, tool,
  1052. X          ruler_args, XtNumber(ruler_args));
  1053. X--- 106,142 ----
  1054. X  
  1055. X  static Arg    ruler_args[] =
  1056. X  {
  1057. X!     /*  0 */ { XtNwidth, (XtArgVal) 0 },
  1058. X!     /*  1 */ { XtNheight, (XtArgVal) 0 },
  1059. X!     /*  2 */ { XtNlabel, (XtArgVal) "" },
  1060. X!     /*  3 */ { XtNfromHoriz, (XtArgVal) NULL },
  1061. X!     /*  4 */ { XtNhorizDistance, (XtArgVal) 0 },
  1062. X!     /*  5 */ { XtNfromVert, (XtArgVal) NULL },
  1063. X!     /*  6 */ { XtNvertDistance, (XtArgVal) 0 },
  1064. X!     /*  7 */ { XtNresizable, (XtArgVal) False },
  1065. X!     /*  8 */ { XtNtop, (XtArgVal) XtRubber },    /* these will be changed */
  1066. X!     /*  9 */ { XtNbottom, (XtArgVal) XtRubber },
  1067. X!     /* 10 */ { XtNleft, (XtArgVal) XtRubber },
  1068. X!     /* 11 */ { XtNright, (XtArgVal) XtRubber },
  1069. X  };
  1070. X  
  1071. X  extern int    SIDERULER_WIDTH, SIDERULER_HEIGHT;
  1072. X  extern int    TOPRULER_WIDTH, TOPRULER_HEIGHT;
  1073. X  
  1074. X! int 
  1075. X! init_sideruler(tool)
  1076. X      TOOL        tool;
  1077. X  {
  1078. X!     ruler_args[0].value = SIDERULER_WIDTH = RULER_WIDTH;
  1079. X!     ruler_args[1].value = SIDERULER_HEIGHT = CANVAS_HEIGHT;
  1080. X!     ruler_args[3].value = (XtArgVal) canvas_sw;    /* from right edge of canvas */
  1081. X!     ruler_args[5].value = (XtArgVal) topruler_sw;    /* down from top ruler */
  1082. X      /* Place the sideruler below the topruler, next to the canvas,
  1083. X         but fixed offset from the top of the form */
  1084. X!     ruler_args[8].value = (XtArgVal) XtChainTop;
  1085. X!     ruler_args[9].value = (XtArgVal) XtRubber;
  1086. X!     ruler_args[10].value = (XtArgVal) XtChainRight;
  1087. X!     ruler_args[11].value = (XtArgVal) XtChainRight;
  1088. X      
  1089. X      sideruler_sw = XtCreateWidget("sruler", labelWidgetClass, tool,
  1090. X          ruler_args, XtNumber(ruler_args));
  1091. X***************
  1092. X*** 152,161 ****
  1093. X--- 148,183 ----
  1094. X      XClearWindow(tool_d, sideruler_pixwin);
  1095. X  }
  1096. X  
  1097. X+ int 
  1098. X+ init_topruler(tool)
  1099. X+     TOOL        tool;
  1100. X+ {
  1101. X+     ruler_args[0].value = TOPRULER_WIDTH = CANVAS_WIDTH;;    /* width */
  1102. X+     ruler_args[1].value = TOPRULER_HEIGHT = RULER_WIDTH;    /* height */
  1103. X+     ruler_args[3].value = (XtArgVal) panel_sw;
  1104. X+     ruler_args[5].value = (XtArgVal) NULL;
  1105. X+     /* fix the top & bottom to the top of the form,
  1106. X+        the left to the panel, and the right is rubber */
  1107. X+     ruler_args[8].value = (XtArgVal) XtChainTop;
  1108. X+     ruler_args[9].value = (XtArgVal) XtChainTop;
  1109. X+     ruler_args[10].value = (XtArgVal) XtChainLeft;
  1110. X+     ruler_args[11].value = (XtArgVal) XtRubber;
  1111. X+     
  1112. X+     topruler_sw = XtCreateWidget("truler", labelWidgetClass, tool,
  1113. X+         ruler_args, XtNumber(ruler_args));
  1114. X+     return(1);
  1115. X+ }
  1116. X+ 
  1117. X+ redisplay_topruler()
  1118. X+ {
  1119. X+     XClearWindow(tool_d, topruler_pixwin);
  1120. X+ }
  1121. X+ 
  1122. X  setup_rulers()
  1123. X  {
  1124. X      register int        i, j;
  1125. X      register Pixmap        p;
  1126. X+ #define    HINCH    (PIX_PER_INCH / 2)
  1127. X  #define    QINCH    (PIX_PER_INCH / 4)
  1128. X  #define    SINCH    (PIX_PER_INCH / 16)
  1129. X  #define TWOMM    (PIX_PER_CM / 5)    
  1130. X***************
  1131. X*** 167,173 ****
  1132. X          { XtNbackgroundPixmap, (XtArgVal)NULL },
  1133. X      };
  1134. X  
  1135. X!     topruler_pixwin = trswfd = XtWindow(topruler_sw);
  1136. X      sideruler_pixwin = srswfd = XtWindow(sideruler_sw);
  1137. X      XDefineCursor(tool_d, trswfd, (Cursor)bull_cursor.bitmap);
  1138. X      XDefineCursor(tool_d, srswfd, (Cursor)bull_cursor.bitmap);
  1139. X--- 189,195 ----
  1140. X          { XtNbackgroundPixmap, (XtArgVal)NULL },
  1141. X      };
  1142. X  
  1143. X!     topruler_pixwin  = trswfd = XtWindow(topruler_sw);
  1144. X      sideruler_pixwin = srswfd = XtWindow(sideruler_sw);
  1145. X      XDefineCursor(tool_d, trswfd, (Cursor)bull_cursor.bitmap);
  1146. X      XDefineCursor(tool_d, srswfd, (Cursor)bull_cursor.bitmap);
  1147. X***************
  1148. X*** 188,206 ****
  1149. X      XSetForeground(tool_d, gc, fg);
  1150. X      
  1151. X      XDrawString(tool_d, p, gc, 2, TOPRULER_HEIGHT - INCH_MARK - 3,
  1152. X!             INCHES ? "in" : "cm", 2);
  1153. X!     if(INCHES) for (i = SINCH - 1; i <= TOPRULER_WIDTH; i += SINCH)
  1154. X!     {
  1155. X          j = i + 1;
  1156. X          if (j % PIX_PER_INCH == 0)
  1157. X!         {
  1158. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1159. X                  TOPRULER_HEIGHT - INCH_MARK - 1);
  1160. X              sprintf(number, "%d", j / PIX_PER_INCH);
  1161. X!             XDrawString(tool_d, p, gc, i - 2,
  1162. X                  TOPRULER_HEIGHT - INCH_MARK - 3, number,
  1163. X                  j < PIX_PER_INCH * 10 ? 1 : 2);
  1164. X!         }
  1165. X          else if (j % QINCH == 0)
  1166. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1167. X                  TOPRULER_HEIGHT - QUARTER_MARK - 1);
  1168. X--- 210,232 ----
  1169. X      XSetForeground(tool_d, gc, fg);
  1170. X      
  1171. X      XDrawString(tool_d, p, gc, 2, TOPRULER_HEIGHT - INCH_MARK - 3,
  1172. X!             appres.INCHES ? "in" : "cm", 2);
  1173. X!     if(appres.INCHES) 
  1174. X!         for (i = SINCH - 1; i <= TOPRULER_WIDTH; i += SINCH)
  1175. X!         {
  1176. X          j = i + 1;
  1177. X          if (j % PIX_PER_INCH == 0)
  1178. X!             {
  1179. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1180. X                  TOPRULER_HEIGHT - INCH_MARK - 1);
  1181. X              sprintf(number, "%d", j / PIX_PER_INCH);
  1182. X!             XDrawString(tool_d, p, gc, i - 3,
  1183. X                  TOPRULER_HEIGHT - INCH_MARK - 3, number,
  1184. X                  j < PIX_PER_INCH * 10 ? 1 : 2);
  1185. X!             }
  1186. X!         else if (j % HINCH == 0)
  1187. X!             XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1188. X!                 TOPRULER_HEIGHT - HALF_MARK - 1);
  1189. X          else if (j % QINCH == 0)
  1190. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1191. X                  TOPRULER_HEIGHT - QUARTER_MARK - 1);
  1192. X***************
  1193. X*** 207,230 ****
  1194. X          else if (j % SINCH == 0)
  1195. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1196. X                  TOPRULER_HEIGHT - SIXTEENTH_MARK - 1);
  1197. X!     }
  1198. X!     else for (i = TWOMM - 1; i <= TOPRULER_WIDTH; i++)
  1199. X!     {
  1200. X          j = i + 1;
  1201. X          if (j % PIX_PER_CM == 0)
  1202. X!         {
  1203. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1204. X                    TOPRULER_HEIGHT - INCH_MARK - 1);
  1205. X              sprintf(number, "%d", j / PIX_PER_CM);
  1206. X!             XDrawString(tool_d, p, gc, i - 2,
  1207. X                      TOPRULER_HEIGHT - INCH_MARK - 3, number,
  1208. X                      j < PIX_PER_CM * 10 ? 1 : 2);
  1209. X!         }
  1210. X          else if (j % TWOMM == 0)
  1211. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1212. X                    TOPRULER_HEIGHT - QUARTER_MARK - 1);
  1213. X!     }
  1214. X!     ruler_args[0].value = (XtArgVal)p;
  1215. X      XtSetValues(topruler_sw, ruler_args, 1);
  1216. X  
  1217. X      /* The arrows will be XORed into the rulers.
  1218. X--- 233,257 ----
  1219. X          else if (j % SINCH == 0)
  1220. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1221. X                  TOPRULER_HEIGHT - SIXTEENTH_MARK - 1);
  1222. X!         }
  1223. X!     else 
  1224. X!         for (i = TWOMM - 1; i <= TOPRULER_WIDTH; i++)
  1225. X!         {
  1226. X          j = i + 1;
  1227. X          if (j % PIX_PER_CM == 0)
  1228. X!             {
  1229. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1230. X                    TOPRULER_HEIGHT - INCH_MARK - 1);
  1231. X              sprintf(number, "%d", j / PIX_PER_CM);
  1232. X!             XDrawString(tool_d, p, gc, i - 3,
  1233. X                      TOPRULER_HEIGHT - INCH_MARK - 3, number,
  1234. X                      j < PIX_PER_CM * 10 ? 1 : 2);
  1235. X!             }
  1236. X          else if (j % TWOMM == 0)
  1237. X              XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
  1238. X                    TOPRULER_HEIGHT - QUARTER_MARK - 1);
  1239. X!         }
  1240. X!     ruler_args[0].value = (XtArgVal) p;
  1241. X      XtSetValues(topruler_sw, ruler_args, 1);
  1242. X  
  1243. X      /* The arrows will be XORed into the rulers.
  1244. X***************
  1245. X*** 260,268 ****
  1246. X              SIDERULER_HEIGHT);
  1247. X      XSetForeground(tool_d, gc, fg);
  1248. X      
  1249. X!     if( INCHES ) 
  1250. X      {
  1251. X!         if( RHS_PANEL )
  1252. X          {
  1253. X          for (i = SINCH - 1; i <= SIDERULER_HEIGHT; i += SINCH)
  1254. X          {
  1255. X--- 287,295 ----
  1256. X              SIDERULER_HEIGHT);
  1257. X      XSetForeground(tool_d, gc, fg);
  1258. X      
  1259. X!     if( appres.INCHES ) 
  1260. X      {
  1261. X!         if( appres.RHS_PANEL )
  1262. X          {
  1263. X          for (i = SINCH - 1; i <= SIDERULER_HEIGHT; i += SINCH)
  1264. X          {
  1265. X***************
  1266. X*** 311,317 ****
  1267. X      }
  1268. X      else 
  1269. X      {
  1270. X!         if( RHS_PANEL )
  1271. X          {
  1272. X          for (i = TWOMM - 1; i <= SIDERULER_HEIGHT; i++)
  1273. X          {
  1274. X--- 338,344 ----
  1275. X      }
  1276. X      else 
  1277. X      {
  1278. X!         if( appres.RHS_PANEL )
  1279. X          {
  1280. X          for (i = TWOMM - 1; i <= SIDERULER_HEIGHT; i++)
  1281. X          {
  1282. X***************
  1283. X*** 351,357 ****
  1284. X                  }
  1285. X          }
  1286. X      }
  1287. X!     ruler_args[0].value = (XtArgVal)p;
  1288. X      XtSetValues(sideruler_sw, ruler_args, 1);
  1289. X  
  1290. X      /* Colors set as above */
  1291. X--- 378,384 ----
  1292. X                  }
  1293. X          }
  1294. X      }
  1295. X!     ruler_args[0].value = (XtArgVal) p;
  1296. X      XtSetValues(sideruler_sw, ruler_args, 1);
  1297. X  
  1298. X      /* Colors set as above */
  1299. X***************
  1300. X*** 359,365 ****
  1301. X      XSetBackground(tool_d, gc, 0);
  1302. X  
  1303. X      /* make pixmaps for side ruler arrow */
  1304. X!     if( RHS_PANEL )
  1305. X      {
  1306. X          sidearrow_pm = XCreatePixmap(tool_d, sideruler_pixwin,
  1307. X                           srlm_pr.width, srlm_pr.height,
  1308. X--- 386,392 ----
  1309. X      XSetBackground(tool_d, gc, 0);
  1310. X  
  1311. X      /* make pixmaps for side ruler arrow */
  1312. X!     if( appres.RHS_PANEL )
  1313. X      {
  1314. X          sidearrow_pm = XCreatePixmap(tool_d, sideruler_pixwin,
  1315. X                           srlm_pr.width, srlm_pr.height,
  1316. X***************
  1317. X*** 377,410 ****
  1318. X      }
  1319. X  }
  1320. X  
  1321. X- int init_topruler(tool)
  1322. X-     TOOL        tool;
  1323. X- {
  1324. X-     ruler_args[2].value = TOPRULER_WIDTH = CANVAS_WIDTH;;    /* width */
  1325. X-     ruler_args[3].value = TOPRULER_HEIGHT = RULER_WIDTH;    /* height */
  1326. X-     ruler_args[5].value = (XtArgVal)panel_sw;
  1327. X-     ruler_args[7].value = (XtArgVal)NULL;
  1328. X-     /* fix the top & bottom to the top of the form,
  1329. X-        the left to the panel, and the right is rubber */
  1330. X-     ruler_args[10].value = (XtArgVal)XtChainTop;
  1331. X-     ruler_args[11].value = (XtArgVal)XtChainTop;
  1332. X-     ruler_args[12].value = (XtArgVal)XtChainLeft;
  1333. X-     ruler_args[13].value = (XtArgVal)XtRubber;
  1334. X-     
  1335. X-     topruler_sw = XtCreateWidget("truler", labelWidgetClass, tool,
  1336. X-         ruler_args, XtNumber(ruler_args));
  1337. X-     return(1);
  1338. X- }
  1339. X- 
  1340. X- redisplay_topruler()
  1341. X- {
  1342. X-     XClearWindow(tool_d, topruler_pixwin);
  1343. X- }
  1344. X- 
  1345. X  set_rulermark(x, y)
  1346. X  int    x, y;
  1347. X  {
  1348. X!     if( TRACKING )
  1349. X      {
  1350. X          set_siderulermark(y);
  1351. X          set_toprulermark(x);
  1352. X--- 404,413 ----
  1353. X      }
  1354. X  }
  1355. X  
  1356. X  set_rulermark(x, y)
  1357. X  int    x, y;
  1358. X  {
  1359. X!     if( appres.TRACKING )
  1360. X      {
  1361. X          set_siderulermark(y);
  1362. X          set_toprulermark(x);
  1363. X***************
  1364. X*** 422,428 ****
  1365. X  {
  1366. X      int    sy;
  1367. X  
  1368. X!     if( RHS_PANEL ) {
  1369. X          /* Because the ruler uses a background pixmap, we can win
  1370. X             here by using XClearArea to erase the old thing. */
  1371. X          XClearArea(tool_d, sideruler_pixwin,
  1372. X--- 425,431 ----
  1373. X  {
  1374. X      int    sy;
  1375. X  
  1376. X!     if( appres.RHS_PANEL ) {
  1377. X          /* Because the ruler uses a background pixmap, we can win
  1378. X             here by using XClearArea to erase the old thing. */
  1379. X          XClearArea(tool_d, sideruler_pixwin,
  1380. END_OF_FILE
  1381. if test 15556 -ne `wc -c <'ruler.c.diff'`; then
  1382.     echo shar: \"'ruler.c.diff'\" unpacked with wrong size!
  1383. fi
  1384. # end of 'ruler.c.diff'
  1385. fi
  1386. echo shar: End of archive 4 \(of 7\).
  1387. cp /dev/null ark4isdone
  1388. MISSING=""
  1389. for I in 1 2 3 4 5 6 7 ; do
  1390.     if test ! -f ark${I}isdone ; then
  1391.     MISSING="${MISSING} ${I}"
  1392.     fi
  1393. done
  1394. if test "${MISSING}" = "" ; then
  1395.     echo You have unpacked all 7 archives.
  1396.     rm -f ark[1-9]isdone
  1397. else
  1398.     echo You still need to unpack the following archives:
  1399.     echo "        " ${MISSING}
  1400. fi
  1401. ##  End of shell archive.
  1402. exit 0
  1403.  
  1404. dan
  1405. -----------------------------------------------------------
  1406.             O'Reilly && Associates
  1407.         argv@sun.com / argv@ora.com
  1408.        632 Petaluma Ave, Sebastopol, CA 95472 
  1409.      800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
  1410.     Opinions expressed reflect those of the author only.
  1411.